/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package agendacontactos;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.AbstractButton;
import javax.swing.JToggleButton;

/**
 *
 * @author Aula_04_03
 */
public class IGUAgenda extends javax.swing.JFrame implements ActionListener {

    /**
     * Creates new form IGUAgenda
     */
    public IGUAgenda() {
        initComponents();
        //this.botonesLetras();
    }

    
    protected void botonesLetras(){
        String letras="ABCDEFGHIJKLMNÑOPQRSTUVWXYZ";
        // cadena de letras para identificar los botones
        int i;
        for(i=0;i<letras.length();i++){
            JToggleButton btLetra=new JToggleButton();
        btLetra.setText(String.valueOf(letras.charAt(i)));
        btLetra.setMargin(new java.awt.Insets(4, 5, 4, 5));
        btLetra.setMaximumSize(new java.awt.Dimension(40, 20));
        btLetra.setMinimumSize(new java.awt.Dimension(30, 20));
        btLetra.setPreferredSize(new java.awt.Dimension(35, 20));
        panelContactos.add(btLetra);
        grupoLetras.add(btLetra);
        btLetra.addActionListener(new ActionListener(){

                @Override
                public void actionPerformed(ActionEvent e) {
                    AbstractButton btl=(AbstractButton)e.getSource();
                    
                }
            
        });
        
        }
    }
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenu2 = new javax.swing.JMenu();
        jMenuBar2 = new javax.swing.JMenuBar();
        jMenu3 = new javax.swing.JMenu();
        jMenu4 = new javax.swing.JMenu();
        vListadoContactos = new javax.swing.JInternalFrame();
        panelContactos = new javax.swing.JPanel();
        jToggleButton1 = new javax.swing.JToggleButton();
        grupoLetras = new javax.swing.ButtonGroup();
        labelEstado = new javax.swing.JLabel();
        menuContactos = new javax.swing.JMenuBar();
        jMenu5 = new javax.swing.JMenu();
        menuNuevoContacto = new javax.swing.JMenuItem();
        menuVerContactos = new javax.swing.JMenuItem();

        jMenu1.setText("File");
        jMenuBar1.add(jMenu1);

        jMenu2.setText("Edit");
        jMenuBar1.add(jMenu2);

        jMenu3.setText("File");
        jMenuBar2.add(jMenu3);

        jMenu4.setText("Edit");
        jMenuBar2.add(jMenu4);

        vListadoContactos.setVisible(true);

        panelContactos.setMaximumSize(new java.awt.Dimension(20, 236));
        panelContactos.setMinimumSize(new java.awt.Dimension(20, 236));
        panelContactos.setRequestFocusEnabled(false);
        panelContactos.setLayout(new javax.swing.BoxLayout(panelContactos, javax.swing.BoxLayout.Y_AXIS));

        grupoLetras.add(jToggleButton1);
        jToggleButton1.setText("A");
        jToggleButton1.setMargin(new java.awt.Insets(4, 5, 4, 5));
        jToggleButton1.setMaximumSize(new java.awt.Dimension(40, 20));
        jToggleButton1.setMinimumSize(new java.awt.Dimension(30, 20));
        jToggleButton1.setPreferredSize(new java.awt.Dimension(35, 20));
        panelContactos.add(jToggleButton1);

        vListadoContactos.getContentPane().add(panelContactos, java.awt.BorderLayout.WEST);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        labelEstado.setText("cargando");
        getContentPane().add(labelEstado, java.awt.BorderLayout.PAGE_END);

        jMenu5.setText("Agenda");

        menuNuevoContacto.setText("Añadir nuevo Contacto");
        jMenu5.add(menuNuevoContacto);

        menuVerContactos.setText("Ver listado Contactos");
        jMenu5.add(menuVerContactos);

        menuContactos.add(jMenu5);

        setJMenuBar(menuContactos);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(IGUAgenda.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(IGUAgenda.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(IGUAgenda.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(IGUAgenda.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new IGUAgenda().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup grupoLetras;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuBar jMenuBar2;
    private javax.swing.JToggleButton jToggleButton1;
    private javax.swing.JLabel labelEstado;
    private javax.swing.JMenuBar menuContactos;
    private javax.swing.JMenuItem menuNuevoContacto;
    private javax.swing.JMenuItem menuVerContactos;
    private javax.swing.JPanel panelContactos;
    private javax.swing.JInternalFrame vListadoContactos;
    // End of variables declaration//GEN-END:variables

    @Override
    public void actionPerformed(ActionEvent e) {
       JToggleButton btl=(JToggleButton)e.getSource();
       char letra=btl.getText().charAt(0);
    }
}
